﻿package mortal.game.view.copy.yanwuCopy
{
    import Message.DB.Tables.*;
    import mortal.component.window.*;
    import mortal.game.events.*;
    import mortal.game.mvc.*;
    import mortal.game.utils.*;
    import mortal.game.view.copy.*;
    import mortal.mvc.core.*;
    import mortal.mvc.interfaces.*;

    public class YanwuController extends CopyControllerBase
    {
        private var _module:YanwuEnterWin;

        public function YanwuController()
        {
            return;
        }// end function

        private function activesNoticHandler(param1:Object) : void
        {
            return;
        }// end function

        private function onYanwuCopyEnter(event:DataEvent) : void
        {
            CopyUtil.copyCheck(this.enterAfterCheck, event);
            return;
        }// end function

        private function enterAfterCheck(event:DataEvent) : void
        {
            GameProxy.copy.enterSunbath(event.data as int);
            return;
        }// end function

        override public function enterCopy(param1:TCopy) : void
        {
            super.enterCopy(param1);
            return;
        }// end function

        override public function leaveCopy() : void
        {
            super.leaveCopy();
            return;
        }// end function

        private function onLoginSuccess(param1 = null) : void
        {
            if (!YanwuIcon.isViewShow())
            {
            }
            return;
        }// end function

        override protected function initServer() : void
        {
            Dispatcher.addEventListener(EventName.LoginGameSuccess, this.onLoginSuccess);
            Dispatcher.addEventListener(EventName.YanwuShow, this.onYanwuShow);
            return;
        }// end function

        override protected function initView() : IView
        {
            if (this._module == null)
            {
                this._module = new YanwuEnterWin();
                this._module.addEventListener(WindowEvent.SHOW, this.onShow);
                this._module.addEventListener(WindowEvent.CLOSE, this.onClose);
            }
            return this._module;
        }// end function

        protected function onShow(event:WindowEvent) : void
        {
            Dispatcher.addEventListener(EventName.YanwuRequest, this.onYanwuCopyEnter);
            return;
        }// end function

        protected function onClose(event:WindowEvent) : void
        {
            Dispatcher.removeEventListener(EventName.YanwuRequest, this.onYanwuCopyEnter);
            return;
        }// end function

        private function onYanwuShow(param1 = null) : void
        {
            if (!isViewShow)
            {
                view.show();
            }
            else
            {
                view.hide();
            }
            return;
        }// end function

    }
}
